Revert of Revert "test(ssr-tests): print SSR Logs for errors in SSR tests, ALSO when a test times out (#19302) #19326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original PR: #19302
Revert of original PR: #19319 becasue of errors on the
develop
's pipeline https://github.com/SAP/spartacus/actions/runs/11142085195/job/30964328791Now bringing back the contents of the original PR, but with ensuring SSR Tests don't encounter the following error again on the pipeline:
How fixed the problem:
Removed
jest-preset-angular
from the Jest setup of SSR Tests. Used simplyts-jest
instead.Why it helped
I only deduce that the new custom
testEvironment
introduced in the Original PR that extends fromNodeEnvironment
fromjest-environment-node
conflicted with thejest-preset-angular
which under the hood assumes simulating Browser environment (not Node).Why we really don't need or want
jest-preset-angular
in SSR Tests projectjsdom
testEnvironment (see https://github.com/thymikee/jest-preset-angular/blob/ff0895f4b8dfa561c4f4bc9779016d9d4d7213c7/src/presets/index.ts#L6)BrowserDynamicTestingModule
(see https://github.com/thymikee/jest-preset-angular/blob/4c2b674634b64eed267e7c0ddb715f52e7839cba/setup-jest.js#L18)Note: Finally I could reproduce it on local too, while using JS
testEnvironment
file instead of TS. Moreover, I could reproduce it only on the first run of tests on local. On the second run, everything would pass. Only when I renamed the file withtestEvironment
, on the first run of tests, the error could be reproduced again.related to https://jira.tools.sap/browse/CXSPA-8564